// app/service/inventory_service.js
'use strict';

const Service = require('egg').Service;

class InventoryService extends Service {
  // 创建产品
  async createProduct(productData) {
    const { ctx } = this;
    
    try {
      // 直接创建产品
      const product = await ctx.model.ProductModel.create(productData);
      return product;
    } catch (error) {
      ctx.logger.error('创建产品失败:', error);
      throw error;
    }
  }
}

module.exports = InventoryService;